#include "widget.h"
#include <QApplication>
#include <QDebug>

#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>

int main(int argc, char *argv[])
{
    uid_t uid = getuid();
    if (uid == 0) {
        qWarning() << "请使用当前用户执行";
        return 0;
    }

    struct passwd *pw = getpwuid(uid);
    if (!pw) {
        return -1;
    }

    QApplication a(argc, argv);
    qApp->setProperty("User", pw->pw_name);

    Widget w;
    w.show();

    return a.exec();
}
